/*
 * Copyright 2009 SHOP.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.shop.opensocial.mediated.shindig.factories;

import com.shop.opensocial.mediated.types.GroupIdMediator;
import org.apache.shindig.social.opensocial.spi.GroupId;

/**
 * Factory for converting between Mediator type and Shindig type
 *
 * @author Jordan Zimmerman
 */
public class GroupIdMediatorFactory extends GenericMediatorFactory<GroupId, GroupIdMediator>
{
	public static final GenericMediatorFactoryBase<GroupId, GroupIdMediator>		i = new GroupIdMediatorFactory();

	@Override
	protected GroupId internalMake(GroupIdMediator i)
	{
		return new GroupId(fTypeMapper.from(i.getType()), i.getGroupId());
	}

	@Override
	protected GroupIdMediator internalUnmake(GroupId i)
	{
		return new GroupIdMediator(fTypeMapper.to(i.getType()), i.getGroupId());
	}

	private static final EnumMapper<GroupId.Type, GroupIdMediator.Type>		fTypeMapper = new EnumMapper<GroupId.Type, GroupIdMediator.Type>(GroupId.Type.values(), GroupIdMediator.Type.values());

	private GroupIdMediatorFactory()
	{
	}
}
